package com.edu.html.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.edu.common.utils.JaxbDateAdapter;
import com.edu.common.utils.JaxbNumberAdapter;

@XmlAccessorType(XmlAccessType.FIELD)  
@XmlRootElement(name = "books")  
@XmlType(name = "books", propOrder = {"id", "author", "calendar", "price","details" }) 
public class Books implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	@XmlAttribute
	private Integer id;
	
	@XmlElement(name="author")
	private String author;
	
	@XmlElement(name="price")
	@XmlJavaTypeAdapter(JaxbNumberAdapter.class) 
	private Double price; 
	
	@XmlElement(name="calendar")
	@XmlJavaTypeAdapter(JaxbDateAdapter.class) 
	private Date calendar;
	
	@XmlElementWrapper(name="details")
	@XmlElement(name="detail")
	private List<Detail> details;
	
	public List<Detail> getDetails() {
	    return details;
	}
	public void setDetails(List<Detail> pDetails){
		details = pDetails;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String pAuthor) {
		author = pAuthor;
	}
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double pPrice) {
		price = pPrice;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer pId) {
		id = pId;
	}
	
	public Date getCalendar() {
		return calendar;
	}
	public void setCalendar(Date pCalendar) {
		calendar = pCalendar;
	}
	@Override
	public String toString() {
		return "Books [id=" + id + ", author=" + author + ", price=" + price + ", calendar=" + calendar + ", details=" + details + "]";
	}
	
}
